<template>
	<view class="content">
		<!-- #ifdef H5 || APP-PLUS -->
		<view class="message-title">
			<commonTitle title="设置"></commonTitle>
		</view>
		<!-- #endif -->
		<view class="list-scroll-content">
			<view class="user-info-item" @tap="userInfor">
				<view class="item-title">个人资料</view>
				<view class="item-right">
					<image src="../../static/common/question-icon.png" class="question-icon"></image>
				</view>
			</view>
			<navigator url="./about-panda" hover-class="none" style="width: 100%;">
				<view class="user-info-item">
					<view class="item-title">关于熊猫优选</view>
					<view class="item-right">
						<image src="../../static/common/question-icon.png" class="question-icon"></image>
					</view>
				</view>
			</navigator>
			
			<navigator url="./problem-feedback" hover-class="none" style="width: 100%;">
				<view class="user-info-item">
					<view class="item-title">问题反馈</view>
					<view class="item-right">
						<image src="../../static/common/question-icon.png" class="question-icon"></image>
					</view>
				</view>
			</navigator>
			
			<!-- <navigator url="./edit-pwd" hover-class="none" style="width: 100%;">
				<view class="user-info-item">
					<view class="item-title">修改密码</view>
					<view class="item-right">
						<image src="../../static/common/question-icon.png" class="question-icon"></image>
					</view>
				</view>
			</navigator> -->
			
			<view class="user-info-item" @tap="clearStroge">
				<view class="item-title">清除缓存</view>
				<view class="item-right">
					<image src="../../static/common/question-icon.png" class="question-icon"></image>
				</view>
			</view>
			
			<view class="app-qcode">
				<view class="log-out" @tap="logout">
					退出登录
				</view>
			</view>
		</view>
		
		<!-- 清除缓存 -->
		<view class="clear-localstorge" v-if="isclear">
			<view class="tip-block">
				<view class="title">温馨提示</view>
				<view class="msg">清除缓存成功</view>
				<view class="commit-btn" @tap="clearSuccess">确认</view>
			</view>
		</view>
	</view>
</template>

<script>
	import commonTitle from'../../components/titile/title.vue'
	export default{
		components:{
			commonTitle
		},
		data () {
			return {
				isclear:false,
				id:""
			}
		},
		onLoad(option) {
			this.id = option.id;
		},
		methods: {
			userInfor(){
				if(this.id == 2){
					uni.navigateTo({
						url:'../subBack/sub-userInfo/sub-userInfo'
					})
				}else{
					uni.navigateTo({
						url:'./user-info'
					})
				}
			},
			clearStroge(){
				//清除缓存
				// uni.clearStorage();
				uni.removeStorage({
					key:"HistoryFoot",
					success() {
						uni.showToast({
							title:"清除成功"
						})
					}
				})
				 //this.isclear = true;
			},
			clearSuccess(){
				//清除缓存成功
				//this.isclear = false;
			},
			logout(){
				uni.showModal({
					title:"温馨提示",
					content:"您确定退出当前账号吗?",
					success(res) {
						if(res.cancel){
							console.log("取消退出")
						}else if(res.confirm){
							
							uni.removeStorage({
								key:"UserInfo"
							})
							uni.removeStorage({
								key:"isAutoTbao"
							})
							// uni.removeStorage({
							// 	key:"inviteId"
							// })
							uni.removeStorage({
								key:"apptoken",
								success() {
									uni.switchTab({
										url:'../home/home'
									})
								}
							})
						}
					}
					
				})
			}
		}
		
	}
</script>

<style>
	@import url("user-info.css");
</style>
